#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

PYVERS = $(shell pyversions -r debian/control)

build: build-stamp

build-stamp: $(PYVERS:%=build-ext-%-stamp)
	touch $@

build-ext-%-stamp:
	dh_testdir
	$* setup.py build -g
	touch $@

dbg-build-ext-%-stamp:
	dh_testdir
	$*-dbg setup.py build -g
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build*stamp dbg-build*stamp
	rm -rf build
	find . -name '*.pyc' | xargs rm -f
	dh_clean

install: build install-prereq $(PYVERS:%=install-ext-%)

install-prereq:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

install-ext-%:
	$* setup.py install --root=debian/gdevilspie
	find debian/gdevilspie -name '*.pyc' | xargs rm -f

# Build architecture-independent files here.
binary-indep:

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_pycentral -a
	dh_installchangelogs -a
	dh_strip -pgdevilspie 
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install install-prereq
